﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Diagnostics;

namespace Kokomo.Environment.Commanding
{
	/// <summary>
	/// Contains common commands.
	/// </summary>
	public static class CommonCommands
	{
		static CommonCommands()
		{
			BrowseToFileCommand = new ParameterizedCommand(BrowseToFile);
		}

		/// <summary>
		/// Gets the <c>Browse to File</c> command.
		/// </summary>
		/// <remarks>
		/// The command implementation opens Windows Explorer,
		/// selecting the path provided as an argument.
		/// </remarks>
		public static ICommand BrowseToFileCommand { get; private set; }
		private static void BrowseToFile(object arg)
		{
			string fileName = arg as string;
			if (fileName == null) return;

			string commandLine = "/e,/n,/select," + fileName;
			Process.Start("explorer.exe", commandLine);
		}
	}
}
